$(function () {
    $("#del").click(function () {
        $(this).parent().parent().remove();
    })
    $("#dropdown").mouseenter(function () {
        $(this).css("background","#fff")
        $(this).css("border-bottom","2px solid #fff")
        $("#wdjd").css("display","block"); 
    })
    $("#dropdown").mouseleave(function () {
        $(this).css("background","#e3e4e5")
        $(this).css("border-bottom","#e3e4e5")
        $("#wdjd").css("display","none");
    })

    //模拟后台传递的数据
    var j = {
        "top":{"left":["待处理订单","返修退换货","降价商品"],"right":["我的问答","我的关注"]},
        "bottom":{"left":["我的京豆","我的白条"],"right":["我的优惠劵","我的理财"]}
    };
    
    //上div的数据
    var top = j.top;
    //上左div
    var topleftdiv = $("<div class='fore1'></div>")

    for(var i = 0;i<top.left.length;i++){
        topleftdiv.append("<div class='item'><a href='#'>"+top.left[i]+"</a></div>");
    }

    //上右div
    var toprightdiv = $("<div class='fore2'></div>")

    for(var i = 0;i<top.right.length;i++){
        toprightdiv.append("<div class='item'><a href='#'>"+top.right[i]+"</a></div>");
    }

    //把自己创建的div添加进去
    $("#wdjd-1").append(topleftdiv);
    $("#wdjd-1").append(toprightdiv);

    //下div的数据
    var bottom = j.bottom;
    //下左div
    var bottomleftdiv = $("<div class='fore1'></div>")

    for(var i = 0;i<bottom.left.length;i++){
        bottomleftdiv.append("<div class='item'><a href='#'>"+bottom.left[i]+"</a></div>");
    }
    //下右div
    var bottomrightdiv = $("<div class='fore2'></div>")

    for(var i = 0;i<bottom.right.length;i++){
        bottomrightdiv.append("<div class='item'><a href='#'>"+bottom.right[i]+"</a></div>");
    }
    //把自己创建的div添加进去
    $("#wdjd-2").append(bottomleftdiv);
    $("#wdjd-2").append(bottomrightdiv);
})